import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import TodoList from '@/components/TodoList'
import MyRouter from '@/components/MyRouter'
import MySubRouter from '@/components/MySubRouter'
import MySubRouter2 from '@/components/MySubRouter2'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/todo',
      name: 'TodoList',
      component: TodoList,
      redirect: '/MyRouter'
    },
    {
      path: '/first',
      name: 'First',
      alias: '/index',
      component: (resolve) => require(['@/components/First.vue'], resolve)
    },
    {
      path: '/MyRouter',
      name: 'MyRouter',
      component: MyRouter,
      children: [{
        path: 'MySubRouter/:id',
        name: 'MySubRouter',
        component: MySubRouter
      },
      {
        path: 'MySubRouter2',
        name: 'MySubRouter2',
        component: MySubRouter2
      }]
    }
  ]
})
